package fr.inserm.umr915.vcfannotator.bio;

import fr.inserm.umr915.vcfannotator.lang.AbstractCharSeq;

public class ProteinSequence
	extends AbstractCharSeq
	{
	private CharSequence cDNA;
	private GeneticCode geneticCode;
	public ProteinSequence(GeneticCode geneticCode,CharSequence cDNA)
		{
		this.geneticCode=geneticCode;
		this.cDNA=cDNA;
		}
	
	
	@Override
	public char charAt(int i)
		{
		return geneticCode.translate(
			cDNA.charAt(i*3+0),
			cDNA.charAt(i*3+1),
			cDNA.charAt(i*3+2));
		}
	
	@Override
	public int length()
		{
		return this.cDNA.length()/3;
		}

	}
